package com.linkgie.galaxyframework.utils.json;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;

public class SerializeDelegator<T> extends StdSerializer<T> {

	private JsonSerialize<T> serialize;

	protected SerializeDelegator(Class<T> valueType, JsonSerialize<T> serialize) {
		super(valueType);
		this.serialize = serialize;
	}

	@Override
	public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws IOException {
		serialize.serialize(value, gen, provider);
	}

}
